package com.supermap.localization.impl;

import java.util.List;

import org.apache.log4j.Logger;

import com.supermap.localization.api.LocalizationOperation;
import com.supermap.localization.api.SampleComponent;
import com.supermap.localization.commontypes.SampleInfo;
import com.supermap.localization.util.ConfigsUtil;

public class LocalizationExport implements LocalizationOperation {

    private static Logger logger = Logger.getLogger(LocalizationExport.class);

    private SampleComponent dbSampleComp;

    private SampleComponent propSampleComp;

    public void setDbSampleComp(SampleComponent dbSampleComp) {
        this.dbSampleComp = dbSampleComp;
    }

    public void setPropSampleComp(SampleComponent propSampleComp) {
        this.propSampleComp = propSampleComp;
    }

    @Override
    public void execute() {
        List<SampleInfo> infos = dbSampleComp.readSampleTranslate(null);
        propSampleComp.saveSampleTranslate(infos);
        System.out.println("导出成功！参考文件：" + ConfigsUtil.replaceConfig.getTranslateFilePath());
        logger.info("导出成功！参考文件：" + ConfigsUtil.replaceConfig.getTranslateFilePath());
    }

}
